//
//  ViewController.m
//  字体适配
//
//  Created by 谢伟 on 16/3/19.
//  Copyright © 2016年 wei.xie. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSArray *familyNameArr = [UIFont familyNames];
    for(int i = 0; i < [familyNameArr count]; i++) {
        NSString *familyName = [familyNameArr objectAtIndex:i];
        NSArray *fonts = [UIFont fontNamesForFamilyName:familyName];
        for (int j = 0; j < [fonts count]; j++) {
            /*
             * 设置字体两种方式：
             ＊ 1）系统自带字体
             *   拿到UIFont字体名，之后可以通过类似[UIFont fontWithName:@"Copperplate-Light" size:15]设置字体
             *  2）自定义字体
             */
            NSLog(@"%@",[fonts objectAtIndex:j]);
        }
    }
    
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, self.view.bounds.size.width, 44)];
    label1.text = @"新生财有鹿，指引我们的财富成长计划";
    /// 设置系统字体（可以通过NSLog拿到字体名）
    label1.font = [UIFont fontWithName:@"Copperplate-Light" size:15];
    [self.view addSubview:label1];
    
    UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 200, self.view.bounds.size.width, 44)];
    label2.text = @"新生财有鹿，指引我们的财富成长计划";
    /// 设置自定义字体（把字体拖入项目，同时需要设置一下plist文件）
    label2.font = [UIFont fontWithName:@"MicrosoftYaHei" size:15];
    [self.view addSubview:label2];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
